package jehc.djshi.log.service.impl;
import java.util.List;
import java.util.Map;

import jehc.djshi.log.dao.XtLoadinfoDao;
import jehc.djshi.log.model.XtLoadinfo;
import jehc.djshi.log.service.XtLoadinfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import jehc.djshi.common.base.BaseService;
import jehc.djshi.common.util.ExceptionUtil;

/**
 * @Desc 页面加载信息
 * @Author 邓纯杰
 * @CreateTime 2012-12-12 12:12:12
 */
@Service("xtLoadinfoService")
public class XtLoadinfoServiceImpl extends BaseService implements XtLoadinfoService {
	@Autowired
	private XtLoadinfoDao xtLoadinfoDao;
	/**
	* 分页
	* @param condition 
	* @return
	*/
	@SuppressWarnings("unchecked")
	public List<XtLoadinfo> getXtLoadinfoListByCondition(Map<String,Object> condition){
		try {
			return xtLoadinfoDao.getXtLoadinfoListByCondition(condition);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}
	/**
	* 查询对象
	* @param xt_loadinfo_id 
	* @return
	*/
	public XtLoadinfo getXtLoadinfoById(String xt_loadinfo_id){
		try {
			return xtLoadinfoDao.getXtLoadinfoById(xt_loadinfo_id);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}
	/**
	* 添加
	* @param xtLoadinfo
	* @return
	*/
	public int addXtLoadinfo(XtLoadinfo xtLoadinfo){
		int i = 0;
		try {
			i = xtLoadinfoDao.addXtLoadinfo(xtLoadinfo);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}
	/**
	* 修改
	* @param xtLoadinfo
	* @return
	*/
	public int updateXtLoadinfo(XtLoadinfo xtLoadinfo){
		int i = 0;
		try {
			i = xtLoadinfoDao.updateXtLoadinfo(xtLoadinfo);
		} catch (Exception e) {
			TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
		}
		return i;
	}
	/**
	* 删除
	* @param condition 
	* @return
	*/
	public int delXtLoadinfo(Map<String,Object> condition){
		int i = 0;
		try {
			i = xtLoadinfoDao.delXtLoadinfo(condition);
		} catch (Exception e) {
			TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
		}
		return i;
	}
	/**
	 * 分组统计并平均值算法
	 * @return
	 */
	public List<XtLoadinfo> getXtLoadingGroupList(){
		try {
			return xtLoadinfoDao.getXtLoadingGroupList();
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}
}
